<!--月应收表-->
<div class="form-inline">
    <div class="form-group">
        <input type="month" onchange="Page.change_month(this)" class="form-control" value="<?php echo yii::$app->request->get('m')?yii::$app->request->get('m'):date('Y-m');?>" />
    </div>
</div>
<br/>
<div class="col-lg-6 col-md-6 col-xs-6 col-sm-6">
    <b>编制单位：义乌市兢赛电子商务有限公司</b>
    <b style="margin-left:200px">单位:美元</b>
    <table class="table table-borderd">
        <thead>
            <tr>
            <th>id</th>
            <th>订单编号</th>
            <th>业务员</th>
            <th>客户名称</th>
            <th>客户编号</th>
            <th>订单金额</th>
            <th>已收金额</th>
            <th>未收金额</th>
            <th>备注（若涉及跨年度未结账则需要在备注写明原因货物所处位置）</th>
            </tr>
        </thead>
        <?php $order_pay_sum=0;$clean_sum=0;$remain_sum=0;?>
        <?php foreach($this->params['list'] as $k=>$v):?>
            <tr>
                <td><?php echo $k+1;?></td>
                <td><?php echo $v['invoice'];?></td>
                <td><?php echo $v['saleman'];?></td>
                <td><?php echo $v['customer_name'];?></td>
                <td><?php echo $v['customer_num'];?></td>
                <td><?php echo $v['order_pay'];$order_pay_sum+=$v['order_pay'];?></td>
                <td><?php $clean = !empty($v['income'])?($v['income']['in_come']+$v['income']['total_fee']+$v['income']['fee']):0;$clean_sum+=$clean;echo round($clean,2);?></td>
                <td><?php $remain=$v['order_pay']-$clean;$remain_sum+=$remain;echo $remain>0?"<span style='color:red'>".round($remain,2)."</span>":round($remain,2) ; ?></td>
                <td></td>
            </tr>
        <?php endforeach;?>
        <tr>
            <td>统计</td>
            <td colspan=4></td>
            <td><?php echo round($order_pay_sum,2);?></td>
            <td><?php echo round($clean_sum,2);?></td>
            <td><?php echo round($remain_sum,2);?></td>
            <td></td>
        </tr>
    </table>
</div>
<script>
    Page.change_month=function(e){
        window.location.href="/table/finance?type=<?php echo $_GET['type']??4;?>&m="+e.value;
    }
</script>